package JoseH;

import JoseP.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class conectate_1 {
    static String bd = "DBTransportes1";
    static String login = "proyecto1";
    static String password = "pop123";
    static String url = "jdbc:derby://localhost:1527/"+bd;

    Connection con = null;

    public conectate_1() {
        try {
            Class.forName("org.apache.derby.jdbc.ClientDriver");
            con = DriverManager.getConnection(url,login,password);
            if (con!=null){
                System.out.println("Conección a base de datos "+bd+". listo");
            }
        }

        catch(SQLException e){
            System.out.println(e);
        }

        catch(ClassNotFoundException e){
            System.out.println(e);
        }
    }

    public Connection getConnection(){
        return con;
    }

    public void desconectar(){
        con = null;
    } 
}